package com.autonavi.collapse.task.pipe.reader.db;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;

public class DataSourceConnectionFactory implements ConnectionFactory {

    private DataSource dataSource;

    private String name;

    public DataSourceConnectionFactory(String name, DataSource dataSource) {
        this.dataSource = dataSource;
        this.name = name;
    }

    @Override
    public Connection getConnecttion() throws SQLException {
        return dataSource.getConnection();
    }

    @Override
    public String getName() {
        return name;
    }
}
